<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script>
export default {
  name: 'App',
  mounted() { // 兼容 IE 浏览器地址栏手动跳转路由
    function checkIE() {
      return (
        '-ms-scroll-limit' in document.documentElement.style &&
        '-ms-ime-align' in document.documentElement.style
      );
    }
    if (checkIE()) {
      window.addEventListener('hashchange', () => {
        var currentPath = window.location.hash.slice(1);
        if (this.$route.path !== currentPath) {
          this.$router.push(currentPath);
        }
      }, false);
    }
  },
  beforeMount() {
    window.addEventListener('keydown', this.banTab);
  },
  beforeDestroy() {
    window.removeEventListener('keydown', this.banTab);
  },
  methods: {
    banTab(e) {
      if (e.keyCode == 9) {
        console.log('禁用Tab切换');
        e.preventDefault();
        e.returnValue = false;
        return false;
      }
    }
  }
};
</script>

<style lang="scss" scoped>
#app {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #ffffff;
}
</style>
